<template>
  <div>
    <h3>首页</h3>
    <button @click="$router.go(-1)">后退</button>
    <br />
    <button @click="aa">看长津湖</button>
    <button @click="bb">查看歌手刘德华</button>
  </div>
</template>

<script>
export default {
  // 对象写法: 使用name跳转
  methods: {
    aa() {
      this.$router.push({
        name: "movie",
        params: {
          id: "1",
          name: "长津湖",
        },
      });
    },
    bb() {
      this.$router.push({
        name: "music",
        query: {
          id: "7",
          name: "刘德华",
        },
      });
    },
  },
};
</script>

<style scoped>
div {
  min-height: 200px;
  background-color: cornflowerblue;
}
</style>
